package testcase;

import org.junit.Test;

import junit.framework.TestCase;
import dataobj.ConfigTO;

public class TestConfigTO extends TestCase{
	
	private ConfigTO to;
	
	@Override
	public void setUp(){
		to = new dataobj.ConfigTO();
	};
	
	@Test
	public void testFilePath() {
		assertEquals(to.getFilePath(), "");
		to.setFilePath("abcd");
		assertEquals(to.getFilePath(), "abcd");
	}
	
	@Test
	public void testDates() {
		to.setProceedExceptionDates(false);
		assertEquals(to.isProceedExceptionDates(), false);
	}
	
	@Test
	public void testUniversity1() {
		assertEquals(to.setUniversity("cityu"), true);
		assertEquals(to.getUniversity(), "cityu");
	}
	
	@Test
	public void testUniversity2() {
		assertEquals(to.setUniversity("mnop"), false);
		assertEquals(to.getUniversity(), null);
	}
	
	@Test
	public void testStorePath() {
		assertEquals(to.getStorePath(), null);
		to.setStorePath("");
		assertEquals(to.getStorePath(), null);
		to.setStorePath("efgh");
		assertEquals(to.getStorePath(), "efgh");
	}
	
	@Test
	public void testStoreName(){
		to.setStoreName("abcd");
		assertEquals(to.getStoreName(), "abcd");
		to.setStoreName("");
		assertEquals(to.getStoreName(), "calendar");
		to.setStoreName();
		assertEquals(to.getStoreName(), "calendar");
	}
	
	@Test
	public void testGetICSLocation(){
		to.setStorePath("abcd//");
		assertEquals("abcd////calendar.ics", to.getICSLocation());
		to.setStorePath("abcd\\");
		assertEquals("abcd\\\\calendar.ics", to.getICSLocation());
	}
}
